<template>
	<view class="item" @tap="itemClick">
		<view class="img center">
			<image :src="goods.main_image" class="auto-img img-radius"></image>

		</view>
		<view class="info">
			<view class="name">
				{{goods.title}}
			</view>
			<view class="price">
				<span>￥</span>
				<view class="money">{{goods.price/100}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			goods: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {


			}
		},
		methods: {
			itemClick() {
				this.$emit('itemClick', this.goods.id)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		width: 235rpx;
		margin-bottom: 40rpx;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		.img {
			width: 220rpx;
			height: 220rpx;
			border-radius: 8rpx;
		}
		.info{
			display: flex;
			flex-direction: column;
			 
			width: 100%;
		}
		.name {
			margin-top: 8rpx;
			font-size: 24rpx;
			font-weight: 400;
			color: rgba(0, 0, 0, 0.9);
			text-overflow: -o-ellipsis-lastline;
			overflow: hidden; //溢出内容隐藏
			text-overflow: ellipsis; //文本溢出部分用省略号表示
			display: -webkit-box; //特别显示模式
			-webkit-line-clamp: 2; //行数
			line-clamp: 2;
			-webkit-box-orient: vertical; //盒子中内容竖直排列
			height: 62rpx;
			padding: 0rpx 16rpx;
		}

		.price {
			margin-top: 8rpx;
			display: flex;
			align-items: center;
			color: rgba(189, 149, 91, 1);

			span {
				font-size: 20rpx;
			}

			.money {
				font-size: 28rpx;
			}

		}
	}
</style>
